<template>
	<view class="container">
		<view v-for="item in list" class="_select">
			<view class="_select-avatar">
				<image :src="item.technical.touxiang" mode="aspectFill"></image>
			</view>
			<view class="_select-box">
				<text class="_select-title">{{item.technical.title}}</text>
				<view class="_select-price">
					<text>￥{{item.price}}</text>
					<view v-if="item.status == 0" @click="onSelect(item.id)">选择</view>
					<view v-if="item.status == 1" style="background-color: unset;color:red;">已接受</view>
					<view v-if="item.status == -1" style="background-color: unset;color:#999;">已拒绝</view>
				</view>
			</view>
		</view>
	</view>
</template>
<style>
	._select {
		background-color: #fff;
		padding: 40rpx;
		margin: 40rpx 40rpx 0;
		display: flex;
	}

	._select-avatar>image {
		width: 120rpx;
		height: 120rpx;
		border-radius: 50% 50%;
	}

	._select-box {
		flex: 1;
		display: flex;
		flex-direction: column;
		justify-content: space-between;
		margin-left: 20rpx;
	}

	._select-title {
		font-size: 28rpx;
	}

	._select-price {
		display: flex;
		justify-content: space-between;
		align-items: center;
		align-content: center;
	}

	._select-price>text {
		color: red;
		font-size: 32rpx;
		font-weight: bold;
	}

	._select-price>view {
		background-color: #EB0909;
		color: #fff;
		font-size: 28rpx;
		border-radius: 10rpx;
		padding: 10rpx 32rpx;

	}
</style>
<script>
	import pay from '@/common/pay.js'
	import tPayWay from "@/components/views/t-pay-way/t-pay-way"
	export default {
		components: {
			tPayWay
		},
		data() {
			return {
				order_id: 0,
				list: [],
			}
		},
		onLoad: function(options) {
			let _this = this
			console.log(options)
			_this.order_id = options.order_id;
			_this.getLists()
		},
		methods: {
			onSelect(quotation_id) {
				let _this = this
				const redirectUrl = "/pagesA/my/myOrder/yuyueDetail?id=" + _this.order_id;
				uni.showModal({
					title: '提示',
					content: '是否选择这位师傅',
					success(e) {
						if (e.confirm == true) {
							_this.$request.post('Order.doSelectList', {
								order_id: _this.order_id,
								quotation_id: quotation_id,
							}).then(res => {
								if (res.errno == 0) {
									wx.redirectTo({
										url: redirectUrl
									});
								}
							})
						}
					}
				})
			},
			getLists() {
				let _this = this
				_this.$request.post('Order.getSelectList', {
					order_id: _this.order_id
				}).then(res => {
					if (res.errno == 0) {
						_this.list = res.data;
					}
				})
			},
		}
	}
</script>